<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="format-detection" content="telephone=yes"/>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>今日安排</title>
		<link rel="stylesheet" href="../css/mui.min.css">
		<link rel="stylesheet" href="../css/aliyun.css">
		<link rel="stylesheet" href="css/style.css"> 
		<style>
			body{background: #eee;}
			.head{padding: 20px 40px;background: white;}
			.head img{width: 90px;height: 90px;border-radius: 50%;border: 1px solid #999;display: block;float: left;margin-right: 10px;}
			.head span{margin-left: 10px; display: inline-block;height: 90px;line-height: 90px;width: 100px;font-size: 20px;font-weight: bolder; color: #777;letter-spacing: 10px;}
			.title{height: 50px;background: white;margin: 20px 0 5px;line-height: 50px;padding: 0 30px;position: relative;}
			.title i{display: block;width: 6px;height: 16px;position: absolute;top: 15px;left: 20px;background: #1E90FF;}
			.list{width: 100%;height: 40px;margin: 5px 0;padding: 0 20px;background: white;line-height: 40px;font-size: 14px;color: #888;}
			.list span:first-child{display:inline-block;float: left;}
			.list span:last-child{display:inline-block;float: right;}
		</style>
	</head>
	<body>
		<div id="app">
			<header class="mui-bar mui-bar-nav">
				<h1 class="mui-title">个人中心</h1>
			</header>
			<div class="head"><img src="img/iii.jpg" v-show="user.userPicture == ''" alt=""><img :src="user.userPicture" v-show="user.userPicture != ''" alt=""><span>{{user.userName}}</span></div>
			<div class="title">个人信息 <i></i></div>
			<div class="list"><span>负责区域</span><span>{{user.personDutyArea}}</span></div>
			<div class="list"><span>职位</span><span>{{user.personPosition}}</span></div>
			<div class="list"><span>联系地址</span><span>{{user.userAddress}}</span></div>
			<div class="list"><span>人员ID</span><span>{{user.personCode}}</span></div>
			
			<div class="title">软件信息 <i></i></div>
			<div class="list"><span>当前版本</span><span>V1.0.0</span></div>
			<div class="list"><span>官方客服</span><span>0313-5880012</span></div>
			<button @click='logout' style="margin: 40px auto;display: block;background: #1E90FF;padding: 8px 25px;color: white;border-radius: 18px;border: none;">退出登录</button>
		</div>
	</body>
	<script src="../js/mui.min.js"></script>
	<script src="../js/jquery-3.1.0.js"></script>
	<script src="js/base.js"></script>
	<script src="../js/vue.min.js"></script>
	<script src="js/schedule.js"></script>
	<script src="js/tools.js"></script>
	<script src="../js/vue-resource.js"></script>

	<script>
		window.onload = function() {

			mui.init();
			mui('.mui-bar-transparent').transparent({
				top: 0,
				offset: 150,
				duration: 16,
				scrollby: document.querySelector('.mui-scroll-wrapper')
			})
			mui.init({
				gestureConfig: {
					tap: true, //默认为true-----单击事件
					doubletap: true, //默认为false-----双击事件
					longtap: true, //默认为false-------长按事件
					swipe: true, //默认为true------滑动事件
					drag: true, //默认为true------拖动事件
					hold: false, //默认为false，不监听-------按住屏幕事件
					release: false //默认为false，不监听-------------离开屏幕事件
				}
			});

			if (window.plus) {
				plusReady();
			} else {
				document.addEventListener('plusready', plusReady, false);
			}

			function plusReady() {
				var app = new Vue({
					el: "#app",
					data: {
						user:{},
					},
					methods: {
						get_user_info(){
							if(localStorage.getItem('user_id')){								
								
								this.$http.post(TOOL.Host + "sysUserController/querySysUser", {
										data: JSON.stringify({
											userId:localStorage.getItem('user_id'),
											sourceType:2
										})
									}, {
										emulateJSON: true,
										headers: {
											'sourceType': "APP"
										}
									})
									.then(function(res) {
										
										if(res.data.code == 0){
											app.user=res.data.data;
											localStorage.setItem('user_name',res.data.data.userName);
											localStorage.setItem('user_position',res.data.data.personPosition);
											localStorage.setItem('user_head_img',res.data.data.userPicture);
											localStorage.setItem('user_person_id',res.data.data.personId);
										}else{
											mui.toast('用户信息请求失败！')
										}
									}, function(res) {
										console.log(res)
									});									
								
							}
							
						},
						logout(){
							mui.confirm('确认退出登录吗？','',['取消','确认'],function (e) {
								if(e.index == 1){
									localStorage.clear();
									mui.openWindow({
										url:"login.html",
										id:'html/login.html',
										createNew:true,
										show:{
										  autoShow:true,
										  aniShow:'slide-in-bottom',
										  duration:300
										}
									})
								}
							},'div')
						}

					},
					created() {
						TOOL.getFire("get_user_info",function(){
							app.get_user_info();
							
						})
						TOOL.getFire("user_info",function(){
							app.get_user_info();
						})
						this.get_user_info();
						
					}
				})

			}
		}
	</script>
</html>
